/**
 * The main application class. An instance of this class is created by app.js when it
 * calls Ext.application(). This is the ideal place to handle application launch and
 * initialization details.
 */
Ext.define('Monkey.Application', {
    extend: 'Ext.app.Application',

    name: 'Monkey',

    stores: [
        'NavigationTree'
    ],

    launch: function () {
        //存放全局变量
        this.initialGlobalVars();

        //判断是否已经登陆，或者选择了记住登陆
        var loggedIn = Ext.util.Cookies.get(Monkey.Config.loggedIn);
        if (!loggedIn) {
            this.toLogin();
        } else {
            this.toMainPage();
        }
    },

    initialGlobalVars: function () {
        //GlobalVars = {
        //    booleanStore: Ext.create('Ext.data.Store', {
        //        fields: ['label', 'value'],
        //        data: [
        //            {label: '是', value: 'true'},
        //            {label: '否', value: 'false'}
        //        ]
        //    })
        //};
    },

    toLogin: function () {
        Ext.create('Monkey.view.authentication.Login');
    },

    toMainPage: function () {
        Ext.create('Monkey.view.main.Viewport');
    }

});
